<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	template="/forms/default/template.xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:web="http://www.web.com.br/jsf/webutils"
	xmlns:evt="http://www.evento.com.br/jsf/eventoutils">

	<ui:define name="breadcrumbEvento">

		<web:breadcrumb urlIndex="/index.xhtml">

			<p:menuitem
				value="#{messages['navegacao.meuseventos']}"
				action="#{meusEventosUI.prepareSearch}" />
			
			
			<p:menuitem 
				value="#{messages['navegacao.editarevento']}"
				action="/forms/eventos/eventoCadastrar.xhtml" />

			<p:menuitem 
				value="#{messages['navegacao.editarevento.cursos']}" 
				action="#{cursoUI.prepareSearch}" />

			<p:menuitem 
				value="#{messages['navegacao.editarevento.cursos.cadastrar']}" />

		</web:breadcrumb>

	</ui:define>

	<ui:define name="contentEvento">

		<fieldset id="fieldsetCampos" style="padding: 10px;">

			<legend style="font-weight: bold; font-size: 16px; width: auto;">#{messages['global.cadastrar.fieldset']}</legend>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelCursoInstrutor"
					value="#{messages['label.instrutor']}:" required="true"
					width="120px" align="right" />
		
				<p:commandButton id="participanteSearch" icon="ui-icon-search"
					process="@this" update="_searchParticipanteDialogForm"
					actionListener="#{participanteUI.reset}"
					oncomplete="searchParticipanteDialog.show()" global="false" />

				<p:outputPanel id="outputPalestranteNome" autoUpdate="true">

					<p:inputText id="participanteNomeText"
						value="#{palestraUI.bean.participante.cadastro.razaoSocial}"
						required="true" style="width: 425px;" readonly="true" />

					<p:message for="participanteNomeText"
						id="participanteNomeText_message" display="text" redisplay="true" />

				</p:outputPanel>
				
			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelTema"
					value="#{messages['label.tema']}:" required="true" width="120px"
					align="right" />

				<web:fieldSelectOneMenu id="inputTema"
					value="#{cursoUI.bean.tema}" required="true" width="365px">

					<f:selectItems value="#{cursoUI.temas}" var="p" itemValue="#{p}"
						itemLabel="#{p.descricao}" />

					<f:converter converterId="temaConverter" />

				</web:fieldSelectOneMenu>

				<p:message for="inputTemaText" id="inputTema_message" display="text"
					redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelCursoTitulo"
					value="#{messages['label.titulo']}:" required="true"
					width="120px" align="right" />

				<web:fieldInputText id="inputCursoTitulo"
					value="#{cursoUI.bean.titulo}" required="true"
					width="360px" />

				<p:message for="inputCursoTituloText"
					id="labelCursoTitulo_message" display="text"
					redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelCursoDescricao"
					value="#{messages['label.descricao']}:" required="true"
					width="120px" align="right" />

				<web:fieldTextarea id="inputCursoDescricao"
					value="#{cursoUI.bean.descricao}" required="true"
					width="360px" />

				<p:message for="inputCursoDescricaoText"
					id="labelCursoDescricao_message" display="text"
					redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelCursoConteudo"
					value="#{messages['label.conteudo']}:" required="true"
					width="120px" align="right" />

				<web:fieldTextarea id="inputCursoConteudo"
					value="#{cursoUI.bean.conteudo}" required="true"
					width="360px" />

				<p:message for="inputCursoConteudoText"
					id="labelCursoConteudo_message" display="text"
					redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelDataAtividade"
					value="#{messages['label.dataatividade']}:" required="true"
					width="120px" align="right" />

				<web:fieldSelectOneMenu id="inputDataAtividade"
					value="#{cursoUI.bean.dataAtividade}" required="true"
					width="365px">

					<f:selectItems value="#{cursoUI.datasAtividade}" var="p"
						itemValue="#{p}" itemLabel="#{p}" />
						
					<f:convertDateTime pattern="dd/MM/yyyy"
						locale="#{localeUI.locale}" timeZone="#{timeZoneUI.timeZone}" />

				</web:fieldSelectOneMenu>

				<p:message for="inputDataAtividadeText" id="inputDataAtividade_message" display="text"
					redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="5">

				<web:outputTextField id="labelCursoHoraInicio"
					value="#{messages['label.horainicio']}:" required="true"
					width="120px" align="right" />

				<web:fieldMask id="inputCursoHoraInicio"
					value="#{cursoUI.bean.horaInicio}" required="true"
					width="110px" mask="99:99" />

				<web:outputTextField id="labelCursoHoraFim"
					value="#{messages['label.horafim']}:" required="true"
					width="125px" align="right" />

				<web:fieldMask id="inputCursoHoraFim"
					value="#{cursoUI.bean.horaFim}" required="true"
					width="110px" mask="99:99" />

				<p:message for="inputCursoHoraInicioText"
					id="labelCursoHoraInicio_message" display="text"
					redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelLugaresEspacoCurso"
					value="#{messages['label.espaco']}:" required="true"
					width="120px" align="right" />

				<web:fieldSelectOneMenu id="inputLugaresEspacoCurso"
					value="#{cursoUI.bean.espaco}" required="true"
					width="365px">
					
					<f:selectItems value="#{cursoUI.participantesEspacos}" var="p"
						itemValue="#{p}"
						itemLabel="#{p.cadastro.razaoSocial} -> #{p.descricao}" />
					<f:converter converterId="espacoConverter" />

				</web:fieldSelectOneMenu>

				<p:message for="inputLugaresEspacoCursoText"
					id="inputLugaresEspacoCurso_message" display="text" redisplay="true" />

			</h:panelGrid>

			<h:panelGrid columns="3">

				<web:outputTextField id="labelCursoValorInstrutor"
					value="#{messages['label.valorinstrutor']}:" required="false"
					width="120px" align="right" />

				<p:inputText id="inputLugaresEspacoCurso"
					value="#{cursoUI.bean.valorAtividade}" required="true"
					style="width: 100px; text-align: right;"
					onkeyup="inputCurrency_corrigeValor(this,'#{localeUI.currencySymbol}','100')">

					<f:convertNumber for="valorAtividadeText" type="currency"
						locale="#{localeUI.locale}" />

				</p:inputText>

				<p:message for="inputLugaresEspacoCurso"
					id="valorAtividadeCursoText_message" display="text"
					redisplay="true" />
					
			</h:panelGrid>

		</fieldset>

		<fieldset id="fieldsetCursoOpcoes" style="padding: 10px">

			<legend style="font-weight: bold; font-size: 16px; width: auto;">#{messages['global.opcoes.fieldset']}</legend>

			<h:panelGrid columns="2">

				<web:outputTextField id="btnIncluirLabel" value=".:"
					required="false" width="120px" align="right" />

				<web:field for="btnIncluir" mode="1" required="false"
					addMessage="false">

					<p:commandButton id="btnIncluir"
						rendered="#{not cursoUI.isViewing()}"
						value="#{(cursoUI.isInserting()) ? messages['global.msg.incluir'] : messages['global.msg.atualizar']}"
						update="@form" action="#{cursoUI.save}" ajax="true"
						icon="#{messages['global.operations.save.icon']}" process="@form"
						style="margin-right: 5px;" />

					<p:commandButton id="btnReset"
						rendered="#{not cursoUI.isViewing()}"
						value="#{messages['global.msg.reset']}" update="@form"
						icon="#{messages['global.operations.reset.icon']}"
						process="@this" style="margin-right: 5px;" immediate="true" />

					<p:commandButton id="btnVoltar"
						value="#{messages['global.msg.voltar']}" update="@form"
						action="#{cursoUI.prepareSearch}" ajax="true"
						icon="#{messages['global.operations.back.icon']}" process="@this"
						style="margin-right: 5px;" />

				</web:field>

			</h:panelGrid>

		</fieldset>

	</ui:define>

	<ui:define name="dialogs">
	
		<evt:dialogParticipante backingBean="#{cursoUI}" />

	</ui:define>
	
</ui:composition>